<?php
/**
 * Dicts表的Logic
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2017/12/27
 * Time: 11:12
 */

namespace App\Http\Logics\MiniProgramAdmin;


use App\Dicts;
use App\Http\Logics\BaseLogic;
class DictLogic extends BaseLogic
{
    /**
     * 获取字典数据
     * @param $data 筛选条件
     * @return mixed
     */
    private static function  getDict($data){

        $result = Dicts::where(function ($query) use ($data){
            if (!empty($data['category'])){
                $query->where('category', $data['category']);
            }
            if (!empty($data['sort'])){
                $query->where('sort', $data['sort']);
            }
        })->get();

        if (empty($result)){
            return self::response(self::CONTENT_IS_EMPTY);
        }

        return self::response(self::SUCCESS, $result);
    }
}